package com.notes.romania.arrayadapter;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.notes.romania.R;

public class NotificationArrayAdapter extends ArrayAdapter<String> {
	private final Activity context;
	private ArrayList<String> title;
	private ArrayList<String> text;

	static class ViewHolder {
		public TextView title;
		public TextView text;
		public ImageView image;
	}

	public NotificationArrayAdapter(Activity context, ArrayList<String> title, ArrayList<String> text) {
		super(context, R.layout.notificationitem, title);
		this.context = context;
		this.title = title;
		this.text = text;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View rowView = convertView;
		if (rowView == null) {
			LayoutInflater inflater = context.getLayoutInflater();
			rowView = inflater.inflate(R.layout.notificationitem, null);
			ViewHolder viewHolder = new ViewHolder();
			viewHolder.title = (TextView) rowView.findViewById(R.id.TextView01);
			viewHolder.text = (TextView) rowView.findViewById(R.id.TextView02);
			viewHolder.image = (ImageView) rowView.findViewById(R.id.ImageView01);
			rowView.setTag(viewHolder);
		}

		ViewHolder holder = (ViewHolder) rowView.getTag();
		
		holder.title.setText(title.get(position));
		holder.text.setText(text.get(position));
		holder.image.setImageResource(R.drawable.reminder_icon);
				
		return rowView;
	}
	
	public void addText(ArrayList <String> text){
		this.text = text;
	}
} 